<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var email=prompt("请输入邮箱地址：","susan@sohu.com");
			function yanzhengemail(email){
				var n1=email.indexOf("@");
				var n2=email.indexOf(".");
				if (email.length==0){
					return 1;
				}
				else if(n1!=-1&&n2!=-1&&n2>n1){
					return 2;
				}else{
					return 3;
				}
			}
			jieguo=yanzhengemail(email);
			switch (jieguo){
				case 1:
				alert("邮箱不能为空！");
				break;
				case 2:
				alert("邮箱地址正确！，邮箱名称是："+email);
				break;
				case 3:
				alert("邮箱地址必须包含“@”和“.”,且“@”必须在“。”之前！");
				break;
			}
		</script>
	</body>
</html>
